﻿namespace PageTransition
{
    using System;
    using System.Collections.Generic;

    using WP7Contrib.View.Controls.Transitions.Animation;

    public partial class TurnstileFeather : AnimatedBasePage
    {
        public TurnstileFeather()
        {
            InitializeComponent();


            // dont like the fact that i have to do this on every page
            // maybe passing a layout root to the base would be an better option
            AnimationContext = LayoutRoot;
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);


            //setting the list data here instead on on animation complete because the list
            //needs to be there on the page loading to see it animate in
            List<string> strings = new List<string>();
            for (int i = 0; i < 10; i++)
            {
                strings.Add(String.Format("List item {0}", i));
            }
            DataContext = strings;
        }

        protected override AnimatorHelperBase GetAnimation(AnimationType animationType, Uri toOrFrom)
        {
            return base.GetAnimation(animationType, toOrFrom);

            //if (animationType == AnimationType.NavigateForwardIn)
            //{
            //    return new TurnstileFeatherForwardInAnimator() { ListBox = List, RootElement = LayoutRoot };
            //}

            //return new TurnstileFeatherBackwardOutAnimator() { ListBox = this.List, RootElement = this.LayoutRoot };
        }
    }
}